import time

from xinan_ui.proxy.base_page import PageHandle
from xinan_ui.tools.read_yml_xn import ReadYaml

data_eles = ReadYaml(r'D:\testLi\PythonWork\xinan_ui\config\jdzapp.yml').read_yaml()['phone_loginpage']


class PhoneJdzLogin(PageHandle):
    def __init__(self,driver):
        self.driver=driver
        super().__init__(self.driver)

    def phone_login(self,phone_num):
        #输入电话号码
        self.input_element(data_eles[0]['手机号码输入框'],phone_num)
        time.sleep(3)
        # 协议勾选
        self.click_button(data_eles[3]['协议勾选'])
        #点击验证码按钮
        self.click_button(data_eles[1]['验证码按钮'])
        time.sleep(3)
        #点击验证码发送提示框确定
        self.click_button(data_eles[5]['验证码发送提示框'])
        time.sleep(3)
        #输入验证码
        self.input_element(data_eles[2]['验证码输入框'],'000000')
        time.sleep(2)
        # #协议勾选
        # self.click_button(data_eles[3]['协议勾选'])
        time.sleep(1)
        #验证按钮
        self.click_button(data_eles[4]['验证按钮'])
        time.sleep(3)
        #点击过期提示弹窗确定按钮
        try:
            self.click_button(data_eles[6]['过期提示弹窗确定按钮'])
            time.sleep(53)
            self.click_button(data_eles[1]['验证码按钮'])
            time.sleep(3)
            self.click_button(data_eles[5]['验证码发送提示框'])
            time.sleep(3)
            self.click_button(data_eles[4]['验证按钮'])
        except:
            print('没出现过期提示弹窗')




